package com.liming.servlet;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.alibaba.fastjson.JSON;
import com.liming.model.Banner;
import com.liming.service.BannerServiceImpl;
import com.liming.serviceinterface.BannerService;

@WebServlet("/BannerServlet")
public class BannerServlet extends HttpServlet {
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	BannerService bannerService = new BannerServiceImpl();
	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		// TODO Auto-generated method stub
		List<Banner> banners = bannerService.getEanbleBanners();
		String s=JSON.toJSONString(banners);
		System.out.println(s);
		resp.getWriter().write(s);
	}
}
